/* 
 * File:   widget_curve_mouse.h
 * Author: dima
 *
 * Created on 15 Январь 2015 г., 12:06
 */

#ifndef WIDGET_CURVE_MOUSE_H
#define	WIDGET_CURVE_MOUSE_H
#include "widget_curve.h"
class QwtPlotPicker;

class widget_curve_mouse : public widget_curve
{
    Q_OBJECT
public:
    widget_curve_mouse(QWidget *widget = NULL);
    widget_curve_mouse(const QwtText &title, QWidget *widget = NULL);
    virtual ~widget_curve_mouse();
    double get_coordinate() const;// get the coordinate y
    void get_coordinates(double &x, double &y)const ; // get the coordinates
protected:
    // Event handlers
    virtual void mousePressEvent(QMouseEvent *event);
    virtual void mouseReleaseEvent(QMouseEvent *event);
    virtual void mouseMoveEvent(QMouseEvent * event);
signals:
    void update_data(int index, double x, double y); // update the data for the curve
private:
    void find_vertex(); // search vertex
    void init_window(); // initialization window
    widget_curve_mouse(const widget_curve_mouse&);
    QwtPlotPicker *d_picker; // To display the coordinates of the mouse
    int current_vertex;
    double current_x;
    double current_y;
};

#endif	/* WIDGET_CURVE_MOUSE_H */

